<template>
  <el-container style="padding: 15px">
    <el-header>
      模版文件生成
    </el-header>
    <el-main>
      <el-upload
          action="http://localhost:8080/ocr_img/orc/1"
          multiple
          :on-success="successHandle"
          :on-exceed="handleExceed">
        <el-button size="small" type="primary">房产证上传</el-button>
      </el-upload>
      <el-divider></el-divider>
      <el-upload
          action="http://localhost:8080/ocr_img/orc/0"
          multiple
          :on-success="successHandle"
          :on-exceed="handleExceed">
        <el-button size="small" type="primary">不动产证上传</el-button>
      </el-upload>
    </el-main>
  </el-container>
</template>

<script>
export default {
  name: "ModelFile",
  methods: {
    successHandle(res, file, fileList) {
      let url = window.URL.createObjectURL(new Blob([res]));
      let link = document.createElement('a');
      link.style.display = 'none';
      link.href = url;
      link.setAttribute('download', 'model.docx');
      document.body.appendChild(link);
      link.click()
    }
  }
}
</script>

<style scoped>

</style>
